#include <WinTen.h>
#include <Windows.h>
#include <ClipApi.h>

static char cHelpFile[ 50 ];

//----------------------------------------------------------------------------//

CLIPPER WINHELP()
{
   _retl( WinHelp( GetActiveWindow(),
                   _parc( 1 ),
                   ( PCOUNT() > 1 ) ? _parni( 2 ): HELP_CONTENTS,
                   _parnl( 3 ) ) );
}

//----------------------------------------------------------------------------//

CLIPPER HelpIndex()
{
   if( cHelpFile[ 0 ] )
      WinHelp( GetActiveWindow(), cHelpFile, HELP_CONTENTS, 0 );
}

//----------------------------------------------------------------------------//

CLIPPER HelpSearch()
{
   if( cHelpFile[ 0 ] )
      WinHelp( GetActiveWindow(), cHelpFile, HELP_PARTIALKEY,
               ( LONG ) ( PCOUNT() ? _parc( 1 ): "" ) );
}

//----------------------------------------------------------------------------//

CLIPPER HelpTopic()
{
   if( cHelpFile[ 0 ] )
      WinHelp( GetActiveWindow(), cHelpFile, HELP_CONTEXTPOPUP,
               _parnl( 1 ) );
}

//----------------------------------------------------------------------------//

CLIPPER HelpSetPos()
{
   HELPWININFO WinInfo;

   WinInfo.x    = _parni( 1 );
   WinInfo.y    = _parni( 2 );
   WinInfo.dx   = _parni( 3 );
   WinInfo.dy   = _parni( 4 );
   WinInfo.wMax = _parl( 5 );
   WinInfo.wStructSize = sizeof( HELPWININFO );
   WinInfo.rgchMember[ 0 ] = 0;
   WinInfo.rgchMember[ 1 ] = 0;

   if( cHelpFile[ 0 ] )
      WinHelp( GetActiveWindow(), cHelpFile, HELP_SETWINPOS,
               ( LONG ) &WinInfo );
}

//----------------------------------------------------------------------------//

CLIPPER SETHELPFIL()     // E
{
   if( PCOUNT() )
      strcpy( cHelpFile, _parc( 1 ) );
}

//----------------------------------------------------------------------------//

CLIPPER GetHelpFil() { _retc( cHelpFile[ 0 ] ? cHelpFile: "" ); }

//----------------------------------------------------------------------------//
